package com.by.common.dao.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("分页bean")
public class Page {


    private final int DEFAULT_PAGE=1;//默认第一页

    private final int DEFAULT_PAGE_SIZE=10;//默认每页记录十条数据

 @ApiModelProperty("当前第几页，默认是第一页")
    int page;
    @ApiModelProperty("每页记录数,默认10")
    int pageSize;

    public int getPage() {
        if (this.page==0)
            return DEFAULT_PAGE;
        return page;
    }

    public void setPage(int page) {
        if (page<=0)
            this.page=DEFAULT_PAGE;
        else
        this.page = page;
    }

    public int getPageSize() {
        if (this.pageSize==0)
            return DEFAULT_PAGE_SIZE;
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if (pageSize<=0)
            this.pageSize=DEFAULT_PAGE_SIZE;
        else
        this.pageSize = pageSize;
    }
}
